import 'now_playing_btn.dart';

class CPNowPlayingTemplate {
  static const String elementIdName = "CPNowPlayingTemplate";

  List<CPNowPlayingButton>? buttons;

  ///专辑和艺人字符串是否为按钮
  bool? isAlbumArtistButtonEnabled;

  ///下一步 按钮是否显示。
  bool? isUpNextButtonEnabled;

  ///下一步 按钮名称
  String? upNextTitle;

  ///用户点击了下一步 按钮
  Function()? nowPlayingTemplateUpNextButtonTapped;

  ///用户点击了专辑艺术家按钮
  Function()? nowPlayingTemplateAlbumArtistButtonTapped;

  CPNowPlayingTemplate({
    this.buttons,
    this.isAlbumArtistButtonEnabled,
    this.isUpNextButtonEnabled,
    this.upNextTitle,
    this.nowPlayingTemplateUpNextButtonTapped,
    this.nowPlayingTemplateAlbumArtistButtonTapped,
  });

  Map<String, dynamic> toJson() => {
        "_elementId": uniqueId,
        "buttons":
            buttons == null ? null : buttons!.map((e) => e.toJson()).toList(),
        "isAlbumArtistButtonEnabled": isAlbumArtistButtonEnabled,
        "isUpNextButtonEnabled": isUpNextButtonEnabled,
        "upNextTitle": upNextTitle,
      };

  String get uniqueId {
    return elementIdName;
  }
}
